package com.ace.gui;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


import com.ace.gui.*;
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.AcroFields;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.GrayColor;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.TextField;
import java.awt.Color;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
 *
 * @author ali
 */
public class pdf {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException, DocumentException, IOException {
        // TODO code application logic here
        Document document = new Document(new Rectangle(14400, 14400));
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("HelloWorld_1_6.pdf"));
    writer.setPdfVersion(PdfWriter.VERSION_1_6);
    document.open();
    document.add(new Paragraph("Hello Worldsxsqxsxsxsqxqsxqxqsxqxmlkmlkmlkmlkmlk smxsqmlxqs xqsx qs xqs x qsx qs x qs xqs x qs x qs xqs x  xs sq xqs x qsx "));
     document.close();
     
      //PdfReader reader = new PdfReader("HelloWorld_1_6.pdf", null);
        /*Document document = new Document(PageSize.A4.rotate());
    PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
    document.open();
    PdfPTable table = new PdfPTable(4);
    table.setWidthPercentage(100);
    PdfPCell cell;
    cell = new PdfPCell(new Paragraph("t"));
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("d"));
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setBackgroundColor(Color.red);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("r"));
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("b"));
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("G:"));
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("0.25"));
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setGrayFill(0.25f);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("0.5"));
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setGrayFill(0.5f);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("0.75"));
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setGrayFill(0.75f);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(":"));
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("a"));
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("b"));
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph("o"));
    cell.setBorderWidth(6f);
    cell.setBorderColor(Color.orange);
    table.addCell(cell);    
    document.add(table);

    document.close();*/
    /*Document document = new Document(PageSize.A4);
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(
        "HelloWorldForm.pdf"));
    document.open();
    BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI,
        BaseFont.NOT_EMBEDDED);
    PdfContentByte cb = writer.getDirectContent();
    cb.beginText();
    cb.setFontAndSize(bf, 12);
    cb.moveText(36f, 788);
    cb.showText("Hello");
    cb.endText();

    TextField tf = new TextField(writer, new Rectangle(67, 785, 340, 800),
        "Who");
    tf.setFontSize(12);
    tf.setFont(bf);
    tf.setText("Who?");
    tf.setTextColor(new GrayColor(0.5f));
    writer.addAnnotation(tf.getTextField());

    document.close();

    PdfReader reader;
    PdfStamper stamper;
    AcroFields form;
    reader = new PdfReader("HelloWorldForm.pdf");
    stamper = new PdfStamper(reader, new FileOutputStream(
        "HelloWorldFilledInForm.pdf"));
    form = stamper.getAcroFields();
    form.setField("Who", "World");
    stamper.close();
    reader = new PdfReader("HelloWorldForm.pdf");
    stamper = new PdfStamper(reader, new FileOutputStream(
        "HelloWorldFilledInFlattened.pdf"));
    form = stamper.getAcroFields();
    form.setField("Who", "People");
    stamper.setFormFlattening(true);
    stamper.close();*/
    }
    
}
